package org.itcast.adi.planinfo.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResultBean<T> {
    private int code;
    private String msg;
    private T datas;

    public static <E> ResultBean<E> success() {
        return new ResultBean<>(1,"success",null);
    }

    public static <E> ResultBean<E> success(E e) {
        return new ResultBean<>(1,"success",e);
    }

    public static <E> ResultBean<E> error(E e) {
        return new ResultBean<>(1,"error",e);
    }

    public static <E> ResultBean<E> error() {
        return new ResultBean<>(1,"error",null);
    }

    public static <E> ResultBean<E> errorException(int code,E e) {
        return new ResultBean<>(code,"error",e);
    }

}
